package com.baomidou.mybatisplus.criterion;

import org.springframework.expression.TypedValue;

/**
 * Constrains a property to be non-null
 * @author Timothy Ren
 */
public class NotNullExpression implements QueryCriterion {

	private static final long serialVersionUID = 1L;
	private static final TypedValue[] NO_VALUES = new TypedValue[0];
	private final String propertyName;

	protected NotNullExpression(String propertyName) {
		this.propertyName = propertyName;
	}

	public String toSqlString() {
		StringBuffer sb = new StringBuffer(propertyName).append(" is not null ");
		return sb.toString();
	}

	public Object[] getValueArr() {
		return NO_VALUES;
	}

	@Override
	public String toString() {
		return propertyName + " is not null";
	}

}
